import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import tools from './utils'
import elementUI from 'element-ui'
import './premission'
import 'element-ui/lib/theme-chalk/index.css'
import './styles/app.scss'
import './styles/common.scss'
import './styles/element.scss'
import './styles/projectSelf.scss'
import echarts from 'echarts/lib/echarts'
import moment from 'moment'
Vue.prototype.$echarts = echarts
Vue.prototype.$moment = moment

Vue.config.productionTip = false

Vue.use(elementUI)
tools.setRem() // 开启rem

// 批量注册公共组件
const requireComponent = require.context('./components', false, /\.vue$/)
requireComponent.keys().forEach((fileName) => {
  const componentConfig = requireComponent(fileName)
  const componentName = fileName.replace(/^\.\//, '').replace(/\.vue/, '')
  Vue.component(componentName, componentConfig.default || componentConfig)
})

new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')
